import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import Layout from '@/layout/index.vue'

export const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'main',
    component: Layout,
    redirect: '/dashboard',
    meta: {
      title: 'dashboard',
      icon: 'component'
    },
    children: [
      {
        path: 'dashboard',
        component: () => import('@/views/dashboard/index.vue'),
        name: 'Dashboard',
        meta: {
          title: 'dashboard',
          affix: true
        }
      }
    ]
  },
  {
    path: '/zhangyanan',
    name: 'zhangyanan',
    component: Layout,
    meta: {
      title: '张雅楠',
      icon: 'list'
    },
    redirect: '/zhangyanan/list',
    children: [
      {
        path: 'list',
        component: () => import('@/views/dashboard/index.vue'),
        name: 'list',
        meta: {
          title: '列表',
          affix: true
        }
      }
    ]
  },
  {
    path: '/function',
    name: 'function',
    component: Layout,
    meta: {
      title: '功能',
      icon: 'clipboard'
    },
    redirect: '/function/clipboard',
    children: [
      {
        path: 'clipboard',
        component: () => import('@/views/function/clipboard.vue'),
        name: 'clipboard',
        meta: {
          title: 'clipboard',
          affix: true
        }
      },
      {
        path: 'pdf',
        component: () => import('@/views/function/pdf.vue'),
        name: 'pdf',
        meta: {
          title: 'pdf',
          affix: true
        }
      },
      {
        path: 'execl',
        component: () => import('@/views/function/execl.vue'),
        name: 'execl',
        meta: {
          title: 'Execl',
          affix: true
        }
      }
    ]
  },
  {
    path: '/pdf-download-content',
    component: () => import('@/views/function/pdf-download-content.vue'),
    meta: { hidden: true }
  }
]

export const basics: Array<RouteRecordRaw> = [
  {
    path: '/login',
    component: () => import('@/views/logo/index.vue'),
    meta: {
      hidden: true
    }
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes: basics.concat(routes)
})

export default router
